/**
 * Copyright 2022-2023 SpriteLab @ Northeastern University
 *
 * This file is part of 5GSniffer.
 *
 * 5GSniffer is free software: you can redistribute it and/or modify
 * it under the terms of the GNU Affero General Public License as
 * published by the Free Software Foundation, either version 3 of
 * the License, or (at your option) any later version.
 *
 * 5GSniffer is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU Affero General Public License for more details.
 *
 * A copy of the GNU Affero General Public License can be found in
 * the LICENSE file in the top-level directory of this distribution
 * and at http://www.gnu.org/licenses/.
 *
 */

#include "gtest/gtest.h"
#include "sss.h"
#include "fftw3.h"
// #include "mat.h"

class sss_test : public ::testing::Test {
 protected:
  sss_test() {
  }

};

TEST_F(sss_test, test_sss_set) {

sss sss1;

int n_id_1 = sss1.get_nid_1();
int n_id_2 = sss1.get_nid_2();

EXPECT_EQ(n_id_1, 0);
EXPECT_EQ(n_id_2, 0);

// sss1.set_nid_1(-1);

// EXPECT_EQ(sss1.get_nid_1(), 0);

// sss1.set_nid_2(-1);

// EXPECT_EQ(sss1.get_nid_2(), 0);

// sss1.set_nid_1(336);

// EXPECT_EQ(sss1.get_nid_1(), 0);

// sss1.set_nid_2(4);

// EXPECT_EQ(sss1.get_nid_2(), 0);

// sss1.set_nid_1(4);

// EXPECT_EQ(sss1.get_nid_1(), 4);

// sss1.set_nid_2(2);

// EXPECT_EQ(sss1.get_nid_2(), 2);

}

TEST_F(sss_test, test_sss_frequency) {

  sss sss1;

  std::array <std::complex<float>,sss_length>  sss_seq_0_0 = sss1.generate_sss_seq(0,0);

  std::array <std::complex<float>,sss_length>  sss_seq_10_0 = sss1.generate_sss_seq(10,0);

  std::array <std::complex<float>,sss_length>  sss_seq_10_1 = sss1.generate_sss_seq(10,1);

  std::array <std::complex<float>,sss_length>  sss_seq_330_2 = sss1.generate_sss_seq(330,2);

  std::array <std::complex<float>,sss_length>  sss_seq_335_2 = sss1.generate_sss_seq(335,2);

  std::array <std::complex<float>,sss_length> sss_seq_ref_0_0 = {1,1,1,1,1,1,1,1,1,1,-1,1,1,1,1,1,-1,1,1,1,-1,1,-1,1,-1,1,1,-1,-1,1,1,1,-1,-1,-1,1,-1,1,-1,1,1,1,1,1,1,1,-1,-1,1,1,1,-1,1,-1,-1,-1,-1,-1,-1,-1,-1,1,-1,1,1,-1,1,1,1,1,-1,1,-1,-1,1,-1,-1,1,-1,1,-1,-1,-1,-1,1,1,-1,-1,-1,-1,1,1,-1,-1,-1,-1,-1,1,1,1,-1,1,-1,1,1,1,1,1,-1,-1,1,1,1,-1,1,1,1,-1,1,1,-1,-1,-1,1,-1,-1,-1};
  
  std::array <std::complex<float>,sss_length> sss_seq_ref_10_0 = {-1,1,1,-1,-1,1,1,-1,1,-1,-1,-1,1,-1,-1,-1,1,-1,-1,-1,-1,1,-1,1,-1,1,-1,-1,-1,1,1,1,1,1,-1,1,-1,1,1,1,-1,1,1,1,-1,-1,1,1,1,1,-1,-1,1,-1,1,-1,1,1,-1,-1,1,-1,1,1,-1,-1,-1,1,1,-1,1,-1,1,1,1,1,-1,1,-1,1,1,1,1,-1,1,1,1,-1,-1,1,1,1,1,1,-1,1,1,1,-1,1,1,-1,-1,-1,-1,-1,-1,1,1,1,1,1,1,1,-1,1,-1,-1,1,-1,-1,1,1,-1,-1,1,1};

  std::array <std::complex<float>,sss_length> sss_seq_ref_10_1 = {1,1,-1,-1,-1,-1,1,1,-1,1,1,1,1,1,-1,1,1,1,-1,-1,-1,1,1,1,1,-1,-1,1,1,-1,-1,1,1,-1,1,-1,-1,1,-1,1,1,1,-1,-1,-1,-1,-1,-1,1,1,-1,-1,1,1,-1,-1,-1,-1,-1,1,1,1,-1,-1,-1,1,-1,1,1,1,-1,-1,1,-1,1,1,-1,-1,-1,1,1,1,1,-1,-1,1,1,1,-1,1,-1,-1,1,-1,-1,1,-1,-1,1,-1,1,1,1,1,-1,-1,-1,1,-1,-1,-1,-1,-1,-1,1,1,-1,-1,-1,1,1,1,-1,1,-1,1,1};

  std::array <std::complex<float>,sss_length> sss_seq_ref_330_2 = {-1,1,1,-1,1,1,1,1,1,-1,-1,-1,-1,-1,1,1,-1,1,1,1,1,1,1,-1,1,-1,1,-1,-1,1,1,1,-1,1,1,1,1,-1,-1,-1,1,1,-1,-1,-1,-1,-1,-1,1,-1,-1,1,1,-1,1,1,1,-1,-1,-1,1,1,-1,1,1,1,1,-1,-1,-1,1,1,1,1,-1,1,1,-1,1,-1,-1,1,-1,1,-1,1,1,-1,-1,1,1,-1,1,1,1,-1,1,1,-1,1,1,-1,-1,1,1,-1,1,1,1,-1,-1,1,-1,-1,1,-1,-1,1,1,-1,-1,1,-1,1,1,-1,1};
 
  std::array <std::complex<float>,sss_length> sss_seq_ref_335_2 = {-1,1,-1,-1,-1,-1,1,1,-1,1,1,-1,1,-1,-1,1,-1,-1,-1,-1,-1,-1,1,1,1,-1,1,-1,1,-1,-1,1,-1,1,-1,1,1,1,-1,-1,-1,-1,-1,1,1,-1,1,-1,-1,1,-1,-1,-1,1,-1,1,-1,1,-1,-1,1,-1,1,1,-1,1,1,1,-1,1,-1,-1,1,-1,1,-1,1,-1,-1,1,-1,1,1,1,1,1,-1,-1,1,-1,-1,1,-1,-1,-1,-1,1,1,-1,1,1,1,-1,1,1,-1,1,-1,-1,-1,-1,1,-1,1,1,1,-1,1,1,1,1,-1,1,1,1,1,1};

  for (int i = 0; i < sss_seq_0_0.size(); ++i) {
    EXPECT_FLOAT_EQ((sss_seq_0_0.at(i)).real(), (sss_seq_ref_0_0.at(i)).real()) << "Vectors x and y differ at real index " << i;
    EXPECT_FLOAT_EQ((sss_seq_0_0.at(i)).imag(), (sss_seq_ref_0_0.at(i)).imag()) << "Vectors x and y differ at imaginary index " << i;
  }

  for (int i = 0; i < sss_seq_10_0.size(); ++i) {
    EXPECT_FLOAT_EQ((sss_seq_10_0.at(i)).real(), (sss_seq_ref_10_0.at(i)).real()) << "Vectors x and y differ at real index " << i;
    EXPECT_FLOAT_EQ((sss_seq_10_0.at(i)).imag(), (sss_seq_ref_10_0.at(i)).imag()) << "Vectors x and y differ at imaginary index " << i;
  }

  for (int i = 0; i < sss_seq_10_1.size(); ++i) {
    EXPECT_FLOAT_EQ((sss_seq_10_1.at(i)).real(), (sss_seq_ref_10_1.at(i)).real()) << "Vectors x and y differ at real index " << i;
    EXPECT_FLOAT_EQ((sss_seq_10_1.at(i)).imag(), (sss_seq_ref_10_1.at(i)).imag()) << "Vectors x and y differ at imaginary index " << i;
  }

  for (int i = 0; i < sss_seq_330_2.size(); ++i) {
    EXPECT_FLOAT_EQ((sss_seq_330_2.at(i)).real(), (sss_seq_ref_330_2.at(i)).real()) << "Vectors x and y differ at real index " << i;
    EXPECT_FLOAT_EQ((sss_seq_330_2.at(i)).imag(), (sss_seq_ref_330_2.at(i)).imag()) << "Vectors x and y differ at imaginary index " << i;
  }

  for (int i = 0; i < sss_seq_335_2.size(); ++i) {
    EXPECT_FLOAT_EQ((sss_seq_335_2.at(i)).real(), (sss_seq_ref_335_2.at(i)).real()) << "Vectors x and y differ at real index " << i;
    EXPECT_FLOAT_EQ((sss_seq_335_2.at(i)).imag(), (sss_seq_ref_335_2.at(i)).imag()) << "Vectors x and y differ at imaginary index " << i;
  }


}

TEST_F(sss_test, test_sss_time) {
  sss sss1;

  std::array <std::complex<float>,sss_length>  sss_seq_0_0 = sss1.generate_sss_seq(0,0);

  std::array <std::complex<float>,sss_length>  sss_seq_10_0 = sss1.generate_sss_seq(10,0);

  std::array <std::complex<float>,sss_length>  sss_seq_10_1 = sss1.generate_sss_seq(10,1);

  std::array <std::complex<float>,sss_length>  sss_seq_330_2 = sss1.generate_sss_seq(330,2);

  std::array <std::complex<float>,sss_length>  sss_seq_335_2 = sss1.generate_sss_seq(335,2);

  
  std::array <std::complex<float>,ssb_nfft> sss_seq_t_0_0 = sss1.convert_sss_t(sss_seq_0_0);

  std::array <std::complex<float>,ssb_nfft> sss_seq_t_10_0 = sss1.convert_sss_t(sss_seq_10_0);

  std::array <std::complex<float>,ssb_nfft> sss_seq_t_10_1 = sss1.convert_sss_t(sss_seq_10_1);

  std::array <std::complex<float>,ssb_nfft> sss_seq_t_330_2 = sss1.convert_sss_t(sss_seq_330_2);

  std::array <std::complex<float>,ssb_nfft> sss_seq_t_335_2 = sss1.convert_sss_t(sss_seq_335_2);


  std::array <std::complex<float>,ssb_nfft> sss_seq_ref_t_0_0 = {15.0000000000000 + 0.00000000000000i,1.87460998778754 - 17.7858965851639i,-18.3132897805693 - 9.91709206355966i,-17.1278244172334 + 4.70268854507772i,1.90251331766089 - 1.61206404699205i,12.4555523595468 - 14.6615146603342i,4.97726290913886 - 4.31887292993958i,-5.23394636711598 + 20.5379783438541i,-5.06247220663097 + 26.3909511293007i,1.64119402086167 + 11.2123494801934i,6.85139004841865 + 3.44774180138834i,9.70740032666767 + 11.0977669924461i,11.8843228416836 + 13.1883048407800i,12.7411184539848 + 2.35960100649988i,11.8211209092888 - 2.85524594133638i,9.24339132619174 + 5.42870209800814i,3.90454759223490 + 10.0782015624102i,-2.76534515774098 + 1.46373852744816i,-4.18964489915913 - 5.25372393223451i,3.08367619842489 + 1.75593318480560i,11.8589231956831 + 10.4592900767889i,12.7868489900356 + 6.88027365221531i,7.11218859009119 - 2.59957000634467i,2.95177738472598 - 5.30332407865296i,2.14181207027042 - 2.54432728821912i,-0.361366239835540 - 2.12464488252802i,-5.96017789598853 - 3.24883729892375i,-9.90229935731578 - 1.46767400221825i,-8.91325909310723 + 1.08133616810440i,-4.78797302957655 + 0.964257275538173i,-0.898192136649604 + 1.06213396387919i,0.0284628132380282 + 4.35868562954280i,-3.53553390593274 + 7.05025253169417i,-9.07653160207981 + 4.61562880116656i,-10.2137349404516 - 1.47915381987424i,-3.79106587826527 - 7.67356329882094i,6.04584604386793 - 12.0300045693040i,13.6159201395428 - 11.2521793108924i,16.7177619953718 - 2.85781960915429i,13.3318079827629 + 6.65969992832940i,1.03328833703308 + 6.23004036405605i,-15.1454695006998 - 3.06114001888091i,-22.3176945161590 - 6.91431667805214i,-14.6625907041501 + 0.682207097783702i,-2.29443380190876 + 6.82464065272234i,2.07245439752276 - 0.649641479973926i,-1.08722290947847 - 13.7111526000164i,-3.13781846097603 - 16.0574292334405i,-1.21111055711128 - 6.60685419694907i,1.68068234870588 + 2.00672647832387i,4.50533356449759 + 3.65958077752181i,7.20924394594702 + 3.66599278374348i,6.98647304227677 + 4.71751268638048i,3.54339778646632 + 1.63232470052086i,2.07075507430868 - 6.70414046821113i,3.25888812846534 - 11.6007521138069i,-1.27280632081677 - 7.03642120404380i,-13.5414404778579 + 0.286128067683745i,-18.8855311710441 + 1.04668928916793i,-5.50457040512088 - 2.17521271812231i,13.3552516191166 + 0.189321972573641i,14.4582651655260 + 7.81943446618579i,-1.90604221548175 + 9.42324843594065i,-12.2556096616972 + 0.703098161928915i,-4.00000000000000 - 7.00000000000000i,9.47011539143446 - 2.99480980308341i,12.1082940527087 + 5.59777172546633i,6.46727142210239 + 3.60233175304411i,3.28360840683353 - 8.92582317562795i,3.48770826075880 - 15.7078393573149i,1.56321514295044 - 7.91372090502335i,-1.91874164242267 + 3.11024264946632i,-1.98622319391629 + 2.56575406119689i,1.12842082219576 - 7.58054132871029i,2.95704604785531 - 13.4355659619590i,2.97088502463917 - 8.49331917300747i,4.64982305535889 + 0.831714449108203i,8.28836382076034 + 6.46959380496581i,9.45703555012899 + 7.32394906601197i,5.41666647531718 + 6.41709577647934i,-0.445743692381101 + 5.39314580305093i,-2.18380629022141 + 3.63600369208870i,1.76170356258562 + 0.294500650497600i,6.51253171741796 - 3.46919254019235i,6.50789202695628 - 4.04200430674215i,2.60539062172672 + 0.544656426363297i,0.834071549561933 + 5.62061657244099i,3.48514524510736 + 3.58404275592890i,5.28720863662070 - 5.10631691178255i,1.07170730869786 - 10.0653575618908i,-6.37560506004955 - 4.52156591270914i,-10.1317535522448 + 4.21393702647527i,-8.09518296863026 + 3.95992556481479i,-3.74165555312765 - 6.21481943338975i,-0.0765726366883062 - 16.1458742936589i,2.47438055357241 - 18.8412849881979i,3.53553390593274 - 16.9497474683058i,2.72330800454765 - 14.9081284588376i,1.56009662380593 - 12.2214921046694i,1.93771649353451 - 7.45702182370957i,3.46220178927588 - 3.31748660502036i,4.95037713829342 - 3.05995403381688i,6.68839541206822 - 4.45733761934305i,8.51905927744763 - 2.06695201829665i,8.50825370455294 + 4.46246118644991i,6.68533672581427 + 8.33156777470873i,6.46517443994267 + 4.10504956018719i,8.36332216917123 - 4.26702111573707i,6.85257417101065 - 7.90774911126924i,-0.746441803063660 - 4.65330846620940i,-6.84187515485527 - 0.961295039061630i,-3.09673143898788 - 1.21262217902624i,5.75230665725748 - 1.92179843758976i,7.22181718517844 - 0.593410215576255i,-0.644378102827551 - 2.78116709234587i,-6.54372443516863 - 12.0638904637435i,-3.13186603207576 - 18.8841791261012i,2.88817801274175 - 11.2394950486129i,2.15000368382197 + 5.66807514385977i,-4.19755617319727 + 13.5673242687686i,-8.64906102711310 + 6.33627214504901i,-8.30223349291916 - 1.82837699966329i,-4.84825625028860 + 1.95803537918529i,1.45365018721070 + 11.3556031365524i,9.64531238599791 + 12.1977463965476i,12.5954604991840 + 2.77817584263204i,2.95736851314536 - 6.23653945095644i,-14.2450084722396 - 6.67466803360671i,-23.0000000000000 + 0.00000000000000i,-14.2450084722396 + 6.67466803360671i,2.95736851314536 + 6.23653945095644i,12.5954604991840 - 2.77817584263204i,9.64531238599790 - 12.1977463965476i,1.45365018721070 - 11.3556031365524i,-4.84825625028860 - 1.95803537918528i,-8.30223349291916 + 1.82837699966329i,-8.64906102711310 - 6.33627214504901i,-4.19755617319727 - 13.5673242687686i,2.15000368382197 - 5.66807514385978i,2.88817801274175 + 11.2394950486129i,-3.13186603207576 + 18.8841791261012i,-6.54372443516863 + 12.0638904637435i,-0.644378102827552 + 2.78116709234588i,7.22181718517843 + 0.593410215576255i,5.75230665725748 + 1.92179843758976i,-3.09673143898788 + 1.21262217902623i,-6.84187515485528 + 0.961295039061628i,-0.746441803063660 + 4.65330846620940i,6.85257417101065 + 7.90774911126924i,8.36332216917123 + 4.26702111573707i,6.46517443994267 - 4.10504956018719i,6.68533672581427 - 8.33156777470873i,8.50825370455294 - 4.46246118644990i,8.51905927744763 + 2.06695201829665i,6.68839541206822 + 4.45733761934305i,4.95037713829342 + 3.05995403381688i,3.46220178927588 + 3.31748660502036i,1.93771649353450 + 7.45702182370958i,1.56009662380593 + 12.2214921046694i,2.72330800454765 + 14.9081284588376i,3.53553390593274 + 16.9497474683058i,2.47438055357241 + 18.8412849881979i,-0.0765726366883064 + 16.1458742936589i,-3.74165555312765 + 6.21481943338975i,-8.09518296863026 - 3.95992556481479i,-10.1317535522448 - 4.21393702647527i,-6.37560506004956 + 4.52156591270914i,1.07170730869786 + 10.0653575618908i,5.28720863662070 + 5.10631691178255i,3.48514524510736 - 3.58404275592890i,0.834071549561934 - 5.62061657244098i,2.60539062172672 - 0.544656426363300i,6.50789202695628 + 4.04200430674215i,6.51253171741796 + 3.46919254019235i,1.76170356258562 - 0.294500650497600i,-2.18380629022141 - 3.63600369208870i,-0.445743692381101 - 5.39314580305093i,5.41666647531718 - 6.41709577647934i,9.45703555012899 - 7.32394906601196i,8.28836382076034 - 6.46959380496581i,4.64982305535889 - 0.831714449108203i,2.97088502463917 + 8.49331917300747i,2.95704604785531 + 13.4355659619590i,1.12842082219577 + 7.58054132871029i,-1.98622319391629 - 2.56575406119689i,-1.91874164242267 - 3.11024264946632i,1.56321514295044 + 7.91372090502335i,3.48770826075880 + 15.7078393573149i,3.28360840683353 + 8.92582317562795i,6.46727142210240 - 3.60233175304412i,12.1082940527087 - 5.59777172546633i,9.47011539143446 + 2.99480980308341i,-4.00000000000000 + 7.00000000000000i,-12.2556096616972 - 0.703098161928915i,-1.90604221548175 - 9.42324843594065i,14.4582651655260 - 7.81943446618579i,13.3552516191166 - 0.189321972573640i,-5.50457040512088 + 2.17521271812231i,-18.8855311710441 - 1.04668928916793i,-13.5414404778579 - 0.286128067683745i,-1.27280632081677 + 7.03642120404380i,3.25888812846534 + 11.6007521138069i,2.07075507430868 + 6.70414046821113i,3.54339778646632 - 1.63232470052086i,6.98647304227677 - 4.71751268638048i,7.20924394594702 - 3.66599278374348i,4.50533356449759 - 3.65958077752181i,1.68068234870588 - 2.00672647832387i,-1.21111055711128 + 6.60685419694907i,-3.13781846097604 + 16.0574292334405i,-1.08722290947847 + 13.7111526000164i,2.07245439752276 + 0.649641479973927i,-2.29443380190876 - 6.82464065272234i,-14.6625907041501 - 0.682207097783702i,-22.3176945161590 + 6.91431667805214i,-15.1454695006998 + 3.06114001888091i,1.03328833703308 - 6.23004036405605i,13.3318079827629 - 6.65969992832940i,16.7177619953718 + 2.85781960915429i,13.6159201395428 + 11.2521793108924i,6.04584604386793 + 12.0300045693040i,-3.79106587826527 + 7.67356329882094i,-10.2137349404516 + 1.47915381987424i,-9.07653160207981 - 4.61562880116656i,-3.53553390593274 - 7.05025253169417i,0.0284628132380291 - 4.35868562954280i,-0.898192136649604 - 1.06213396387919i,-4.78797302957656 - 0.964257275538173i,-8.91325909310723 - 1.08133616810440i,-9.90229935731577 + 1.46767400221825i,-5.96017789598854 + 3.24883729892375i,-0.361366239835541 + 2.12464488252802i,2.14181207027042 + 2.54432728821912i,2.95177738472598 + 5.30332407865296i,7.11218859009119 + 2.59957000634466i,12.7868489900356 - 6.88027365221531i,11.8589231956831 - 10.4592900767889i,3.08367619842489 - 1.75593318480560i,-4.18964489915913 + 5.25372393223451i,-2.76534515774098 - 1.46373852744816i,3.90454759223490 - 10.0782015624102i,9.24339132619174 - 5.42870209800814i,11.8211209092888 + 2.85524594133638i,12.7411184539848 - 2.35960100649988i,11.8843228416836 - 13.1883048407800i,9.70740032666767 - 11.0977669924461i,6.85139004841865 - 3.44774180138834i,1.64119402086167 - 11.2123494801934i,-5.06247220663098 - 26.3909511293007i,-5.23394636711598 - 20.5379783438541i,4.97726290913886 + 4.31887292993958i,12.4555523595468 + 14.6615146603342i,1.90251331766089 + 1.61206404699205i,-17.1278244172334 - 4.70268854507772i,-18.3132897805693 + 9.91709206355966i,1.87460998778754 + 17.7858965851639i};

  std::array <std::complex<float>,ssb_nfft> sss_seq_ref_t_10_0 = {15.0000000000000 + 0.00000000000000i,14.5439199950221 + 9.84751808781634i,11.6138703559832 + 8.29661310365223i,3.69704048272090 - 0.703166401243644i,-7.87045702586223 - 4.10792213473513i,-16.1284968554824 + 2.54713930328395i,-14.5511138700115 + 10.5985381098188i,-5.30659921300236 + 10.2184490114975i,2.37544237522718 + 1.55342060689016i,3.36584330805437 - 6.43100525349164i,1.40177933216813 - 5.41587494685549i,0.401514117939927 + 3.66466966645679i,-2.40779701348412 + 10.4280920553946i,-8.86878093481133 + 5.66049412440859i,-11.5207829826786 - 6.91880444162413i,-2.65311502016698 - 13.4647543298806i,10.8376419702125 - 6.70612351868148i,12.8517052101388 + 4.86326980361156i,-0.264072175043583 + 8.16816994949658i,-13.6635887103950 + 1.46652996691977i,-13.3939190189323 - 5.97926455380580i,-3.06440417318714 - 6.78239578407318i,4.18785931749812 - 2.22064206111430i,2.97227926479548 + 2.03555912779284i,-1.87284526552953 + 1.66448100003898i,-4.83485590433574 - 3.86840120926037i,-4.54566525921359 - 10.0157390062587i,-1.51341084278471 - 9.25701716536839i,3.24799434862227 + 0.844388936290938i,7.96732151516878 + 12.2572646380750i,11.1267018768961 + 13.8737110279263i,11.4490362276616 + 4.40967382950611i,6.94974746830583 - 6.46446609406726i,-1.90305436826438 - 10.1936940091151i,-8.55702955893924 - 7.72949212335270i,-6.57320527790634 - 4.59135564562935i,0.120943832840888 - 2.82447283752938i,1.31371521137184 - 1.52197285166164i,-4.29940896367550 - 1.49071828310727i,-8.12657657043118 - 4.03007478134896i,-7.54899115298429 - 6.43447008698419i,-9.88872475527031 - 4.30463514018677i,-16.2574153278536 + 0.949352783144214i,-16.1257628870126 + 2.17002283972969i,-5.71566902328652 - 3.64113697024226i,3.15044498623476 - 10.3163494149954i,2.91407518603147 - 11.2698873713471i,3.44568522477667 - 8.79664928903785i,11.8390325133825 - 8.96376249024450i,15.1740897950384 - 10.8391004591084i,1.86520085068296 - 8.52898368365878i,-14.1627013933275 - 2.34102546796583i,-13.3552113565251 + 0.727825172636425i,-3.32599210484691 - 1.87600540279133i,-5.73276387242554 - 4.93879573860446i,-17.8337627154850 - 4.56820054966291i,-16.2351097119472 - 2.40644914959558i,2.72907988739452 + 0.465835037838102i,15.9809176430712 + 4.60346372386496i,10.8613359435256 + 5.75698196030949i,1.56842954049237 - 1.47541187151084i,1.11765052170486 - 10.9684168993091i,2.83186902466280 - 9.25993747889050i,0.0267010386691410 + 3.00643715603424i,0.00000000000000 + 9.00000000000000i,5.58535905541412 + 2.21435405291369i,4.75179065285238 - 2.50315393262723i,-6.70599274156401 + 4.00015918627560i,-12.1365059265747 + 6.37975389198004i,-0.0767801508085615 - 8.49146690389425i,14.6869466917297 - 23.6543612730521i,14.0479048042933 - 16.2489396356863i,4.53959158190201 + 3.12428457986478i,2.61970496262162 + 5.11933380094774i,5.66848900891971 - 10.8740355195648i,-0.0794220995150070 - 16.6458343995419i,-11.7451673026916 - 2.91240598537597i,-12.8713626267515 + 6.56935959146562i,-0.750999542115520 - 3.05306769052469i,9.60009092951573 - 13.3955926966304i,8.64624886085605 - 6.13533536549831i,2.60663460890499 + 6.16578457125393i,-0.630829937907745 + 3.38749298360303i,-1.45391380994652 - 8.25623641573278i,-2.09375903392992 - 8.95078557258747i,-1.81757673980087 + 1.44164550629425i,-1.01874982580589 + 5.96977515186778i,-1.51968378621253 - 0.658665094559539i,-1.98174257647607 - 6.73895195693905i,-0.455078308985414 - 4.64432523537698i,-0.500072670108865 - 0.0704270339028508i,-6.51858239284215 + 0.550656807746477i,-14.0694059167019 - 0.885101869051493i,-13.9090738348825 + 0.323711832696129i,-5.92132494045563 + 5.20589237784843i,-0.275541460245964 + 11.1036987927561i,-2.94974746830583 + 13.5355339059327i,-7.58845964074032 + 9.75281058243901i,-4.94987560386260 + 3.64067351522789i,4.60949616083993 + 2.92914166827765i,11.6710304837159 + 8.44061415426121i,8.83691788700698 + 12.2034030233831i,-0.896899444922050 + 9.88814911388981i,-7.28484104411187 + 7.31698459042754i,-4.59642100501011 + 9.35999913008413i,1.39588961889597 + 10.7585149425225i,1.13771464892705 + 5.33362995791507i,-5.87620718897067 - 2.85200965853527i,-11.7672156723284 - 5.63205890665864i,-12.7448819665085 - 2.54224875144349i,-12.5316544854285 + 0.692890472629655i,-12.2902454919798 + 0.470917286269394i,-7.32292334445105 - 3.87769639393529i,1.98394371948169 - 11.6834684585849i,6.13699056627889 - 17.4526133624656i,0.524414918631184 - 12.8015263306266i,-5.46238707577629 + 1.13100664788983i,-2.22696288375962 + 10.4427278569932i,4.49015180073062 + 5.96480744267058i,2.59010007983218 - 2.78793028603660i,-6.67992424518203 - 0.915845663649486i,-9.65327750612756 + 10.1818654394310i,0.248230790971993 + 15.6063825040264i,14.0309733658750 + 8.57560469673719i,19.4090961604217 - 1.90961062073663i,13.9414405081449 - 5.28129456062247i,3.88607071304365 - 1.99209044614256i,-4.11931794921223 + 0.793743422209121i,-7.00000000000000 + 0.00000000000000i,-4.11931794921223 - 0.793743422209120i,3.88607071304365 + 1.99209044614256i,13.9414405081449 + 5.28129456062247i,19.4090961604217 + 1.90961062073663i,14.0309733658750 - 8.57560469673719i,0.248230790971992 - 15.6063825040264i,-9.65327750612755 - 10.1818654394310i,-6.67992424518203 + 0.915845663649485i,2.59010007983218 + 2.78793028603660i,4.49015180073062 - 5.96480744267059i,-2.22696288375962 - 10.4427278569932i,-5.46238707577629 - 1.13100664788983i,0.524414918631186 + 12.8015263306266i,6.13699056627889 + 17.4526133624656i,1.98394371948169 + 11.6834684585849i,-7.32292334445105 + 3.87769639393529i,-12.2902454919798 - 0.470917286269392i,-12.5316544854285 - 0.692890472629653i,-12.7448819665085 + 2.54224875144349i,-11.7672156723284 + 5.63205890665863i,-5.87620718897066 + 2.85200965853527i,1.13771464892704 - 5.33362995791507i,1.39588961889597 - 10.7585149425225i,-4.59642100501011 - 9.35999913008413i,-7.28484104411188 - 7.31698459042754i,-0.896899444922052 - 9.88814911388982i,8.83691788700698 - 12.2034030233831i,11.6710304837159 - 8.44061415426121i,4.60949616083993 - 2.92914166827765i,-4.94987560386259 - 3.64067351522789i,-7.58845964074032 - 9.75281058243901i,-2.94974746830583 - 13.5355339059327i,-0.275541460245965 - 11.1036987927561i,-5.92132494045563 - 5.20589237784843i,-13.9090738348825 - 0.323711832696130i,-14.0694059167019 + 0.885101869051493i,-6.51858239284215 - 0.550656807746480i,-0.500072670108864 + 0.0704270339028517i,-0.455078308985414 + 4.64432523537698i,-1.98174257647607 + 6.73895195693905i,-1.51968378621253 + 0.658665094559539i,-1.01874982580589 - 5.96977515186778i,-1.81757673980087 - 1.44164550629425i,-2.09375903392991 + 8.95078557258747i,-1.45391380994651 + 8.25623641573279i,-0.630829937907748 - 3.38749298360303i,2.60663460890499 - 6.16578457125393i,8.64624886085605 + 6.13533536549831i,9.60009092951573 + 13.3955926966304i,-0.750999542115523 + 3.05306769052469i,-12.8713626267515 - 6.56935959146561i,-11.7451673026916 + 2.91240598537597i,-0.0794220995150088 + 16.6458343995419i,5.66848900891971 + 10.8740355195648i,2.61970496262162 - 5.11933380094774i,4.53959158190201 - 3.12428457986478i,14.0479048042933 + 16.2489396356863i,14.6869466917297 + 23.6543612730521i,-0.0767801508085624 + 8.49146690389426i,-12.1365059265747 - 6.37975389198004i,-6.70599274156402 - 4.00015918627560i,4.75179065285238 + 2.50315393262723i,5.58535905541412 - 2.21435405291369i,0.00000000000000 - 9.00000000000000i,0.0267010386691413 - 3.00643715603424i,2.83186902466280 + 9.25993747889050i,1.11765052170486 + 10.9684168993091i,1.56842954049237 + 1.47541187151084i,10.8613359435256 - 5.75698196030949i,15.9809176430712 - 4.60346372386496i,2.72907988739452 - 0.465835037838101i,-16.2351097119472 + 2.40644914959558i,-17.8337627154850 + 4.56820054966291i,-5.73276387242554 + 4.93879573860446i,-3.32599210484691 + 1.87600540279133i,-13.3552113565251 - 0.727825172636426i,-14.1627013933275 + 2.34102546796583i,1.86520085068296 + 8.52898368365879i,15.1740897950384 + 10.8391004591084i,11.8390325133825 + 8.96376249024450i,3.44568522477667 + 8.79664928903785i,2.91407518603146 + 11.2698873713471i,3.15044498623476 + 10.3163494149954i,-5.71566902328652 + 3.64113697024226i,-16.1257628870126 - 2.17002283972969i,-16.2574153278536 - 0.949352783144213i,-9.88872475527031 + 4.30463514018677i,-7.54899115298429 + 6.43447008698419i,-8.12657657043118 + 4.03007478134896i,-4.29940896367550 + 1.49071828310727i,1.31371521137184 + 1.52197285166164i,0.120943832840887 + 2.82447283752938i,-6.57320527790634 + 4.59135564562935i,-8.55702955893924 + 7.72949212335270i,-1.90305436826438 + 10.1936940091151i,6.94974746830583 + 6.46446609406726i,11.4490362276616 - 4.40967382950611i,11.1267018768961 - 13.8737110279263i,7.96732151516878 - 12.2572646380750i,3.24799434862227 - 0.844388936290939i,-1.51341084278471 + 9.25701716536839i,-4.54566525921359 + 10.0157390062587i,-4.83485590433574 + 3.86840120926037i,-1.87284526552953 - 1.66448100003898i,2.97227926479548 - 2.03555912779284i,4.18785931749812 + 2.22064206111430i,-3.06440417318714 + 6.78239578407318i,-13.3939190189323 + 5.97926455380580i,-13.6635887103950 - 1.46652996691977i,-0.264072175043580 - 8.16816994949658i,12.8517052101388 - 4.86326980361156i,10.8376419702125 + 6.70612351868148i,-2.65311502016698 + 13.4647543298806i,-11.5207829826786 + 6.91880444162413i,-8.86878093481133 - 5.66049412440859i,-2.40779701348413 - 10.4280920553946i,0.401514117939927 - 3.66466966645679i,1.40177933216813 + 5.41587494685549i,3.36584330805437 + 6.43100525349164i,2.37544237522718 - 1.55342060689016i,-5.30659921300236 - 10.2184490114975i,-14.5511138700115 - 10.5985381098188i,-16.1284968554824 - 2.54713930328395i,-7.87045702586223 + 4.10792213473513i,3.69704048272090 + 0.703166401243644i,11.6138703559832 - 8.29661310365223i,14.5439199950221 - 9.84751808781634i};

  std::array <std::complex<float>,ssb_nfft> sss_seq_ref_t_10_1 = {-1.00000000000000 + 0.00000000000000i,-3.69751805410955 - 5.69985120443915i,-6.27813975063462 - 3.18788541886765i,-2.42589885261419 + 7.45834070507928i,3.00059635932098 + 16.2425732673726i,2.09106337532421 + 12.9540604487045i,-2.41930285298465 + 0.477100899142431i,-1.99316482301250 - 6.46268425751121i,3.24181996688336 - 0.180473729145716i,4.94628787409140 + 8.12375621802738i,0.00187880368399096 + 3.68371376337871i,-4.83252213507791 - 9.20935469881501i,-2.32649934427750 - 12.3744664603552i,6.08624850971640 - 0.813345442768847i,11.4295994761940 + 10.2738034871495i,6.32937927552822 + 9.56848957406468i,-5.69566114799564 + 5.13672590866835i,-11.4585591471327 + 6.89433899587996i,-3.15606373768812 + 8.42898125155672i,9.89307567268396 + 0.453561245971381i,12.2377510413760 - 9.34933182855185i,3.20170678154353 - 7.57949377003383i,-3.96999253545711 + 1.28320167487038i,-3.35214756021108 + 1.36288610685212i,-3.00340594867876 - 8.42098761672130i,-8.00003416340833 - 13.5225412516727i,-11.8434111771066 - 7.97345065659538i,-10.3122173832678 - 0.887787253598285i,-9.11140063578752 + 2.14730001137196i,-10.3556901696262 + 5.89042807997078i,-6.34255170039048 + 10.6316507513601i,3.96968374219365 + 8.26055741916697i,7.53553390593274 - 1.53553390593274i,-1.95710010412199 - 6.81080526744420i,-10.7719797773609 - 1.05929308611899i,-7.12193371761849 + 8.18435808178573i,-2.31265564098782 + 12.9221490897908i,-11.9241928511887 + 13.2745187586500i,-27.5392682962381 + 9.47337604427071i,-28.2587773250492 + 0.756722699652461i,-13.2206664757207 - 4.84886871304973i,-1.13995354985512 + 2.38131152954007i,-0.774897481267738 + 13.1266781153657i,-2.66796241888309 + 6.47327883952426i,0.0338511871843714 - 15.0817376210990i,2.53951999947087 - 22.0053560340943i,2.92694735196575 - 1.40507402174212i,7.46091593121700 + 19.8907377503425i,15.9658435851660 + 14.4558323391521i,17.3325764465337 - 5.21430029428427i,6.66802564380970 - 9.28342810519561i,-5.28386723011379 + 3.24848590550591i,-6.94836722323764 + 8.97065343799021i,-0.510231558506548 + 0.701817296405491i,4.55199099749126 - 5.35579702172082i,4.26270667293558 - 0.787854830031968i,0.619384563501738 + 3.06494821108346i,-3.78530212591878 - 2.03119345224559i,-6.11989754746013 - 7.37622240081544i,-3.71660168258115 - 2.87604236975410i,1.56101185323329 + 8.40945448814120i,4.13816384911157 + 16.9282382712007i,3.03559284854330 + 17.3847815621103i,4.00501849274207 + 9.85085945993237i,10.0000000000000 - 1.00000000000000i,15.0445857396864 - 6.69163315273802i,12.3828628667961 - 2.98294125168407i,4.84384498305133 + 3.34721820712785i,1.72807859725520 + 2.97775828495438i,6.69595194846719 - 3.27722632252412i,13.0808990294346 - 7.86910226259637i,12.0573518057413 - 8.14804224955194i,3.23184613961240 - 5.62378144429266i,-4.85605598328126 + 0.989062254702133i,-5.02786481580135 + 11.2786756279990i,-0.122282301242972 + 17.0028764520359i,1.35247568289717 + 12.2115692120125i,-3.21252355279325 + 4.28088549856608i,-8.26563535793857 + 2.56415827017873i,-9.54314872119790 + 2.57233544513648i,-9.13741646041983 - 3.68630328457886i,-8.60372796384936 - 8.57724198438613i,-4.31410143038933 + 0.700023110913037i,4.82684558711203 + 16.6185143994302i,11.1101997344447 + 18.2839803430283i,6.89851706489113 + 3.96500269258637i,-3.88639640454496 - 6.05980953175359i,-10.3342778877736 - 2.77178047015455i,-8.18638488806855 - 0.920310248830054i,-2.35861497912035 - 9.84608827018517i,1.95505509520800 - 14.9540557984732i,3.87353642488632 - 2.95369752391602i,3.72706760017676 + 13.3331824557763i,1.78666617159940 + 13.7846491123214i,-0.0364378079305130 + 1.16211181541377i,-0.0317238117652749 - 6.70581736572078i,0.464466094067262 - 5.53553390593274i,-0.0157665208715296 - 5.46900530133039i,0.675981624851640 - 8.42009471385091i,4.65265449471842 - 4.66530029487775i,8.96509001884743 + 7.49686591843673i,9.23055019491354 + 16.0520889559726i,6.02269446764678 + 13.1915920740624i,2.67243722607703 + 5.42124229202451i,-0.560105436009157 + 1.16442509699076i,-4.64938288991461 - 0.0633282784265938i,-7.26293465811585 - 0.664540996633242i,-6.40552030979838 + 2.09760480917259i,-5.53826198390372 + 8.62534987548524i,-7.89028749111809 + 11.0282148216300i,-8.76765532987982 + 3.78900381065341i,-2.22148734323944 - 5.36422581340835i,6.86723402324945 - 5.00540971506260i,7.48612404232111 + 2.84738710620499i,-1.20740811708880 + 5.38088199465893i,-8.83607657711669 - 1.79253658148096i,-9.92114909448333 - 8.52458694642322i,-9.68464004076720 - 6.05003425956204i,-10.9454924049730 + 0.433208013685367i,-7.65924919617186 + 1.17367749326083i,1.87751207847964 - 3.21234913502946i,6.88403186451025 - 4.55008392280761i,-0.450477217484668 - 0.919610766296096i,-10.0610249443951 + 1.52056871189719i,-7.55778815205833 - 0.250590394734979i,2.60512815921963 - 1.85952547599764i,2.64838019511030 - 0.196774895742747i,-10.5351069635732 + 1.39751446627965i,-19.0000000000000 + 0.00000000000000i,-10.5351069635732 - 1.39751446627965i,2.64838019511030 + 0.196774895742748i,2.60512815921963 + 1.85952547599764i,-7.55778815205833 + 0.250590394734980i,-10.0610249443951 - 1.52056871189719i,-0.450477217484667 + 0.919610766296098i,6.88403186451025 + 4.55008392280761i,1.87751207847964 + 3.21234913502946i,-7.65924919617186 - 1.17367749326083i,-10.9454924049730 - 0.433208013685365i,-9.68464004076720 + 6.05003425956204i,-9.92114909448333 + 8.52458694642322i,-8.83607657711670 + 1.79253658148096i,-1.20740811708880 - 5.38088199465893i,7.48612404232111 - 2.84738710620499i,6.86723402324945 + 5.00540971506260i,-2.22148734323945 + 5.36422581340835i,-8.76765532987982 - 3.78900381065341i,-7.89028749111809 - 11.0282148216300i,-5.53826198390372 - 8.62534987548524i,-6.40552030979838 - 2.09760480917259i,-7.26293465811585 + 0.664540996633242i,-4.64938288991461 + 0.0633282784265956i,-0.560105436009157 - 1.16442509699076i,2.67243722607703 - 5.42124229202451i,6.02269446764677 - 13.1915920740624i,9.23055019491354 - 16.0520889559726i,8.96509001884743 - 7.49686591843673i,4.65265449471842 + 4.66530029487775i,0.675981624851640 + 8.42009471385091i,-0.0157665208715292 + 5.46900530133039i,0.464466094067262 + 5.53553390593274i,-0.0317238117652763 + 6.70581736572078i,-0.0364378079305122 - 1.16211181541377i,1.78666617159940 - 13.7846491123214i,3.72706760017676 - 13.3331824557763i,3.87353642488632 + 2.95369752391603i,1.95505509520800 + 14.9540557984732i,-2.35861497912035 + 9.84608827018517i,-8.18638488806855 + 0.920310248830054i,-10.3342778877736 + 2.77178047015455i,-3.88639640454496 + 6.05980953175359i,6.89851706489114 - 3.96500269258637i,11.1101997344447 - 18.2839803430283i,4.82684558711203 - 16.6185143994302i,-4.31410143038933 - 0.700023110913036i,-8.60372796384936 + 8.57724198438613i,-9.13741646041983 + 3.68630328457886i,-9.54314872119790 - 2.57233544513648i,-8.26563535793857 - 2.56415827017873i,-3.21252355279325 - 4.28088549856608i,1.35247568289717 - 12.2115692120125i,-0.122282301242969 - 17.0028764520359i,-5.02786481580135 - 11.2786756279990i,-4.85605598328126 - 0.989062254702132i,3.23184613961240 + 5.62378144429266i,12.0573518057414 + 8.14804224955194i,13.0808990294346 + 7.86910226259637i,6.69595194846719 + 3.27722632252412i,1.72807859725520 - 2.97775828495437i,4.84384498305133 - 3.34721820712785i,12.3828628667961 + 2.98294125168407i,15.0445857396864 + 6.69163315273802i,10.0000000000000 + 1.00000000000000i,4.00501849274207 - 9.85085945993237i,3.03559284854330 - 17.3847815621103i,4.13816384911157 - 16.9282382712007i,1.56101185323329 - 8.40945448814120i,-3.71660168258115 + 2.87604236975410i,-6.11989754746012 + 7.37622240081544i,-3.78530212591878 + 2.03119345224559i,0.619384563501738 - 3.06494821108346i,4.26270667293558 + 0.787854830031966i,4.55199099749126 + 5.35579702172082i,-0.510231558506547 - 0.701817296405491i,-6.94836722323765 - 8.97065343799021i,-5.28386723011379 - 3.24848590550591i,6.66802564380970 + 9.28342810519561i,17.3325764465337 + 5.21430029428428i,15.9658435851660 - 14.4558323391521i,7.46091593121700 - 19.8907377503425i,2.92694735196575 + 1.40507402174212i,2.53951999947087 + 22.0053560340943i,0.0338511871843719 + 15.0817376210990i,-2.66796241888309 - 6.47327883952426i,-0.774897481267739 - 13.1266781153657i,-1.13995354985512 - 2.38131152954007i,-13.2206664757207 + 4.84886871304973i,-28.2587773250492 - 0.756722699652458i,-27.5392682962381 - 9.47337604427071i,-11.9241928511887 - 13.2745187586500i,-2.31265564098782 - 12.9221490897908i,-7.12193371761849 - 8.18435808178573i,-10.7719797773609 + 1.05929308611899i,-1.95710010412199 + 6.81080526744420i,7.53553390593274 + 1.53553390593274i,3.96968374219366 - 8.26055741916697i,-6.34255170039048 - 10.6316507513601i,-10.3556901696262 - 5.89042807997077i,-9.11140063578752 - 2.14730001137196i,-10.3122173832678 + 0.887787253598285i,-11.8434111771066 + 7.97345065659539i,-8.00003416340834 + 13.5225412516727i,-3.00340594867876 + 8.42098761672130i,-3.35214756021108 - 1.36288610685212i,-3.96999253545711 - 1.28320167487038i,3.20170678154353 + 7.57949377003383i,12.2377510413760 + 9.34933182855185i,9.89307567268397 - 0.453561245971381i,-3.15606373768812 - 8.42898125155672i,-11.4585591471327 - 6.89433899587996i,-5.69566114799564 - 5.13672590866835i,6.32937927552822 - 9.56848957406468i,11.4295994761940 - 10.2738034871495i,6.08624850971640 + 0.813345442768849i,-2.32649934427750 + 12.3744664603552i,-4.83252213507791 + 9.20935469881501i,0.00187880368399096 - 3.68371376337871i,4.94628787409140 - 8.12375621802738i,3.24181996688336 + 0.180473729145717i,-1.99316482301250 + 6.46268425751121i,-2.41930285298465 - 0.477100899142431i,2.09106337532421 - 12.9540604487045i,3.00059635932098 - 16.2425732673726i,-2.42589885261419 - 7.45834070507928i,-6.27813975063462 + 3.18788541886765i,-3.69751805410955 + 5.69985120443915i};

  std::array <std::complex<float>,ssb_nfft> sss_seq_ref_t_330_2 = {15.0000000000000 + 0.00000000000000i,8.65312652310881 - 1.79995722570345i,-2.18306600050607 + 2.24743521668721i,-5.24766248337322 + 9.02937956418721i,-0.650175322728725 + 10.6570325933821i,4.18947764344668 + 5.27684940702313i,8.02225708611567 - 1.23448910216997i,12.7631780023511 - 3.77510233228820i,13.4353231312344 - 3.14236619616832i,4.78255320292053 - 1.98828446718876i,-5.74797460708865 - 0.883941501678310i,-6.34203063379864 - 0.354527398858619i,-0.727168112464357 - 1.65085276883380i,-3.63153170321516 - 2.61051620357714i,-14.8712812941009 + 1.64031070805731i,-15.9318283838608 + 9.55303135082762i,0.798978089659708 + 10.9339681792823i,16.6109956684471 + 0.834804697720759i,12.5125437145165 - 9.79783351909174i,-2.95194243061922 - 7.22963811367576i,-7.50171858085105 + 4.42417794629110i,2.68054736712571 + 7.58157209464592i,12.0146098799261 - 3.46053223161793i,11.8668663551842 - 14.2258231184431i,9.58948319352593 - 11.5995300432189i,10.9942935547727 - 2.13835756354626i,10.6840045400555 - 0.284532686320399i,4.79158808170269 - 6.51840384059508i,0.0947992300177556 - 8.57878991425168i,3.03035629928085 - 1.29340610943484i,8.69145707714958 + 6.15535148274938i,8.46540456670561 + 4.57542887774181i,2.94974746830583 - 2.46446609406726i,0.213735168856403 - 5.44207009168225i,4.04763840917688 - 3.25238949456768i,9.58147873345833 - 3.45274215882049i,10.0242430645007 - 8.79843020902010i,4.34980119090892 - 11.1838345315192i,-2.31377922907490 - 3.43755844371643i,-4.77991895994781 + 8.19823074476195i,-3.19687335863062 + 11.4136383478540i,-1.25422630579979 + 5.85701220544311i,-0.0397915241250377 + 3.79909376360720i,2.65527033656016 + 10.6138445963321i,6.49669898138917 + 15.4105296282664i,7.16513622877501 + 8.01737103791757i,2.86406705444645 - 3.91172360070252i,-2.89329097748176 - 5.30173294357016i,-7.34855546557022 + 4.71817869046261i,-11.1252792559813 + 13.4782231309970i,-12.1622184714582 + 14.1487072129577i,-5.55600281985261 + 12.2183236545852i,5.59373856508624 + 12.6719917026875i,8.78033426747138 + 12.3351902407049i,-0.730232305929343 + 7.76562772410122i,-10.5090706039851 + 1.68819421732092i,-8.26051225799474 - 1.84066620954138i,0.619931366198013 - 2.07884696822158i,4.27360035711406 + 0.590954766001095i,4.02207443671342 + 5.35201692111925i,8.16402643145428 + 8.36545456796766i,13.5041036710981 + 5.81136029201037i,10.2752049448542 + 0.361393121235548i,1.52754002852489 - 1.52141839040805i,0.00000000000000 + 1.00000000000000i,6.64769477771933 + 2.60195954640673i,8.88629402397198 + 0.0649479353057479i,1.17196971254697 - 5.62544088426193i,-7.50246807550490 - 13.6662629894114i,-8.20691004866746 - 21.4432032335280i,-1.54348619598602 - 20.1893457413363i,7.44813150368222 - 3.89294188935899i,12.0570639768572 + 17.2458881805941i,4.52425356641031 + 24.3471957797135i,-12.4370827857481 + 13.3931902207602i,-19.7784827945769 - 0.128074261592233i,-5.07231782254234 - 3.42405272152640i,14.2044333409496 - 1.22299613028338i,12.1896011504954 - 2.82132587914287i,-4.95105140406293 - 6.09463909277489i,-7.47987165917597 - 3.76710268377596i,9.26449203575396 + 2.21510646136777i,16.8058371676149 + 2.76207622460787i,1.54832077982584 - 5.03793343420507i,-12.3680945917450 - 14.1214116682720i,-4.12269487943452 - 16.1058803129335i,10.1272110263338 - 9.83274539767549i,7.09380622809617 - 2.12496930018872i,-5.21696647982762 - 1.17856284052706i,-5.43109852327551 - 7.43540854862397i,4.05755149534381 - 12.0531398449712i,6.09797592232180 - 7.76761201536744i,1.14791762793534 + 1.38033739388150i,2.30308427671227 + 6.60383003873241i,7.28074900284894 + 7.08746375263492i,3.08686557398054 + 8.08360246661487i,-6.94974746830583 + 9.53553390593274i,-7.55389845826211 + 7.00569761496253i,-0.162251839943709 + 2.10028709435177i,-1.13857204571995 + 0.385562256142377i,-11.2669599224538 - 0.277087393508648i,-12.8226574329581 - 6.72865969384614i,-1.10692790842225 - 15.7902183756600i,5.51968368852122 - 16.4185556948502i,-4.48935185405245 - 8.19173123160001i,-16.8432304561719 - 3.05439762758816i,-13.6045727461920 - 5.55789091031428i,1.76032675454499 - 6.71789921250030i,13.3731141912069 - 2.32569083006676i,14.5101725001771 - 1.03439311936145i,8.74447985625422 - 6.51267834394512i,-0.493540093047786 - 7.64825525522723i,-9.97055096491352 + 2.44868680504370i,-13.1851207223732 + 11.7527315650785i,-7.42845828112271 + 6.87293190483024i,-0.117462686249038 - 5.88059985359361i,0.205747369920463 - 10.9648246728671i,-4.42591181864443 - 6.48275043763000i,-5.80088287418347 - 2.37646941907855i,-1.96297601791169 - 2.03747827423434i,2.08183364888792 - 0.0558118060328807i,3.41369323463837 + 4.77592837638375i,3.51807879389139 + 7.06795220373173i,2.80714656692318 + 4.96150078271003i,-0.0113830332206568 + 2.74824995384444i,-2.81173633343373 + 3.07238926674603i,-0.863179516227888 + 3.77478833216399i,5.41828511629041 + 2.61893152365692i,9.00000000000000 + 0.00000000000000i,5.41828511629041 - 2.61893152365693i,-0.863179516227887 - 3.77478833216399i,-2.81173633343373 - 3.07238926674603i,-0.0113830332206588 - 2.74824995384444i,2.80714656692319 - 4.96150078271003i,3.51807879389139 - 7.06795220373173i,3.41369323463837 - 4.77592837638375i,2.08183364888793 + 0.0558118060328816i,-1.96297601791169 + 2.03747827423434i,-5.80088287418347 + 2.37646941907855i,-4.42591181864444 + 6.48275043763000i,0.205747369920462 + 10.9648246728671i,-0.117462686249035 + 5.88059985359361i,-7.42845828112271 - 6.87293190483024i,-13.1851207223732 - 11.7527315650785i,-9.97055096491352 - 2.44868680504370i,-0.493540093047784 + 7.64825525522723i,8.74447985625422 + 6.51267834394511i,14.5101725001771 + 1.03439311936145i,13.3731141912069 + 2.32569083006676i,1.76032675454499 + 6.71789921250030i,-13.6045727461920 + 5.55789091031428i,-16.8432304561719 + 3.05439762758815i,-4.48935185405244 + 8.19173123160001i,5.51968368852122 + 16.4185556948502i,-1.10692790842225 + 15.7902183756600i,-12.8226574329581 + 6.72865969384614i,-11.2669599224538 + 0.277087393508646i,-1.13857204571996 - 0.385562256142377i,-0.162251839943709 - 2.10028709435177i,-7.55389845826211 - 7.00569761496253i,-6.94974746830583 - 9.53553390593274i,3.08686557398054 - 8.08360246661487i,7.28074900284894 - 7.08746375263491i,2.30308427671227 - 6.60383003873241i,1.14791762793534 - 1.38033739388150i,6.09797592232180 + 7.76761201536745i,4.05755149534382 + 12.0531398449712i,-5.43109852327551 + 7.43540854862396i,-5.21696647982762 + 1.17856284052706i,7.09380622809618 + 2.12496930018872i,10.1272110263338 + 9.83274539767549i,-4.12269487943453 + 16.1058803129335i,-12.3680945917450 + 14.1214116682720i,1.54832077982584 + 5.03793343420507i,16.8058371676149 - 2.76207622460787i,9.26449203575396 - 2.21510646136777i,-7.47987165917597 + 3.76710268377596i,-4.95105140406293 + 6.09463909277489i,12.1896011504954 + 2.82132587914287i,14.2044333409496 + 1.22299613028339i,-5.07231782254234 + 3.42405272152641i,-19.7784827945769 + 0.128074261592233i,-12.4370827857481 - 13.3931902207602i,4.52425356641031 - 24.3471957797135i,12.0570639768572 - 17.2458881805941i,7.44813150368222 + 3.89294188935898i,-1.54348619598602 + 20.1893457413363i,-8.20691004866746 + 21.4432032335280i,-7.50246807550490 + 13.6662629894114i,1.17196971254697 + 5.62544088426192i,8.88629402397199 - 0.0649479353057467i,6.64769477771933 - 2.60195954640673i,0.00000000000000 - 1.00000000000000i,1.52754002852489 + 1.52141839040805i,10.2752049448542 - 0.361393121235548i,13.5041036710981 - 5.81136029201037i,8.16402643145428 - 8.36545456796766i,4.02207443671343 - 5.35201692111925i,4.27360035711405 - 0.590954766001094i,0.619931366198011 + 2.07884696822158i,-8.26051225799474 + 1.84066620954138i,-10.5090706039851 - 1.68819421732092i,-0.730232305929342 - 7.76562772410122i,8.78033426747138 - 12.3351902407049i,5.59373856508624 - 12.6719917026875i,-5.55600281985261 - 12.2183236545852i,-12.1622184714582 - 14.1487072129577i,-11.1252792559813 - 13.4782231309970i,-7.34855546557022 - 4.71817869046261i,-2.89329097748176 + 5.30173294357016i,2.86406705444645 + 3.91172360070252i,7.16513622877501 - 8.01737103791757i,6.49669898138917 - 15.4105296282664i,2.65527033656016 - 10.6138445963321i,-0.0397915241250360 - 3.79909376360720i,-1.25422630579979 - 5.85701220544311i,-3.19687335863062 - 11.4136383478540i,-4.77991895994781 - 8.19823074476195i,-2.31377922907490 + 3.43755844371643i,4.34980119090892 + 11.1838345315192i,10.0242430645007 + 8.79843020902010i,9.58147873345832 + 3.45274215882049i,4.04763840917688 + 3.25238949456768i,0.213735168856405 + 5.44207009168225i,2.94974746830583 + 2.46446609406726i,8.46540456670562 - 4.57542887774181i,8.69145707714958 - 6.15535148274938i,3.03035629928085 + 1.29340610943484i,0.0947992300177587 + 8.57878991425168i,4.79158808170269 + 6.51840384059508i,10.6840045400555 + 0.284532686320400i,10.9942935547727 + 2.13835756354627i,9.58948319352593 + 11.5995300432189i,11.8668663551842 + 14.2258231184431i,12.0146098799261 + 3.46053223161793i,2.68054736712571 - 7.58157209464592i,-7.50171858085105 - 4.42417794629110i,-2.95194243061922 + 7.22963811367576i,12.5125437145165 + 9.79783351909175i,16.6109956684471 - 0.834804697720758i,0.798978089659708 - 10.9339681792823i,-15.9318283838608 - 9.55303135082762i,-14.8712812941009 - 1.64031070805731i,-3.63153170321515 + 2.61051620357714i,-0.727168112464359 + 1.65085276883380i,-6.34203063379864 + 0.354527398858617i,-5.74797460708865 + 0.883941501678312i,4.78255320292053 + 1.98828446718875i,13.4353231312344 + 3.14236619616832i,12.7631780023511 + 3.77510233228820i,8.02225708611567 + 1.23448910216997i,4.18947764344668 - 5.27684940702313i,-0.650175322728725 - 10.6570325933821i,-5.24766248337322 - 9.02937956418721i,-2.18306600050607 - 2.24743521668720i,8.65312652310881 + 1.79995722570345i};

  std::array <std::complex<float>,ssb_nfft> sss_seq_ref_t_335_2 = {-1.00000000000000 + 0.00000000000000i,-3.02748454294673 + 15.6331310043609i,-4.31795855658755 + 8.99696053899199i,0.609577140925419 - 5.86689871572099i,6.71364290430954 - 3.76246136468684i,5.31821727368912 + 10.0331851064318i,-0.937511439365312 + 11.9692778628210i,-0.845742896619882 + 0.586816432788624i,6.91110338453309 - 5.15575898645043i,9.55058697596590 - 0.687701290643833i,-0.00427726768690651 + 0.00531216288670855i,-9.27582676711759 - 7.01130796688240i,-2.47365755233150 - 9.50071731017865i,15.4695694927888 - 3.10338533024494i,23.6703478529117 + 2.28662508103490i,13.0096168054125 + 3.24638581860534i,-2.96185286131257 + 7.55003722169763i,-7.53066460188875 + 13.8455014317568i,-0.960701077715445 + 8.96224572591681i,4.37545711115115 - 7.13692560654336i,1.51718242173715 - 14.8820051382019i,-5.39502418857365 - 4.00007613433042i,-8.91669152115041 + 9.90893899770160i,-5.49135220763973 + 10.0548224137107i,3.48198279714283 + 2.65816471195959i,12.9531542149732 + 1.69535272002182i,16.9839578593330 + 4.40479285623422i,13.4779232780763 + 0.0496686598944809i,6.44354792963908 - 7.55688557849116i,2.02152457441487 - 5.93022409548124i,2.27822160062495 + 3.42855481345443i,3.48662032204610 + 7.26877649808680i,0.363961030678929 + 3.29289321881345i,-7.62246771883601 + 2.40398527412927i,-13.9270089540677 + 7.49199230942724i,-10.8531910888782 + 7.73850093976871i,0.654939595330032 - 1.49593638834694i,9.84164922201441 - 9.30006799095610i,7.89163497306216 - 7.20101121719990i,-1.55697069711059 - 2.47930365294843i,-7.75006116158439 - 3.76489276074335i,-6.53635956569337 - 5.57562393724157i,-3.48176812266052 + 0.340469886442082i,-4.23525566884074 + 7.90146367945420i,-7.49177870694967 + 5.82261554836820i,-8.43258688166339 - 2.22258520558067i,-4.93867527183470 - 2.76636016828351i,0.831421913379234 + 4.55432965544042i,4.58122207582990 + 6.12892061474413i,3.53724870389693 - 2.17250800191506i,-0.435254736789406 - 7.51145531938565i,-2.85724439998152 - 1.71127266373537i,-2.84993925192666 + 5.02441346548206i,-3.49775042387883 + 1.49221910676150i,-4.38825190307080 - 6.13406025054366i,-0.588089878698798 - 5.56256607552181i,6.54226646718272 + 1.27644872736929i,5.95223989641735 + 2.99121922955727i,-7.19451788678896 - 1.66978561706240i,-19.7743660052583 - 3.07713330219342i,-16.5328433513147 + 2.10903932916727i,-2.17087506401755 + 5.84186227585489i,5.95204903090482 + 2.20194976455440i,3.53084067245991 - 4.01297898040508i,2.00000000000000 - 5.00000000000000i,6.14535461637906 + 0.605257381658682i,6.33309479605704 + 8.04832692955937i,-2.62656230622164 + 11.2773034566605i,-10.5283233615395 + 6.89164455401152i,-7.56952269960260 - 2.23969379361818i,1.02175173803957 - 7.69074044697692i,4.86332057174217 - 4.20949800511183i,3.34762811648418 + 3.16634331103620i,1.84155331513556 + 4.93094328918732i,0.642389406841428 - 1.36599146561462i,-3.06407859095771 - 9.42061447583495i,-7.34878122281903 - 12.1022811856371i,-8.14639365381708 - 7.47275617114000i,-6.92490745612177 + 0.515782984000773i,-8.93121477271584 + 4.34232440036480i,-14.9243678263375 - 0.214225135763486i,-19.2416997294355 - 7.27089271777420i,-15.8646306884259 - 7.14288143578215i,-4.64858651956890 - 1.56929570665941i,7.65275504767958 - 2.46289421059715i,12.8586260296814 - 11.0063401331391i,9.63472782476520 - 12.0247792564488i,4.40287521524008 + 0.983077314047377i,1.53059777674791 + 10.4545706240931i,-2.69998829136827 + 0.570917444994685i,-10.9888939271200 - 14.9328939636217i,-16.1614966118406 - 12.5443284075905i,-11.1556710929693 + 2.72084890929626i,-2.98970554574952 + 4.84992435279869i,-4.04594991894940 - 10.4433778427650i,-11.9216445541034 - 18.3799615645749i,-12.3639610306789 - 4.70710678118655i,-2.30979239744888 + 13.2243014427767i,5.30486866128683 + 14.8534380824198i,2.61441379692936 + 4.25108109447256i,-2.20863442140189 - 3.28091617477400i,-0.345414795043930 - 4.97821899648171i,4.75233997711007 - 6.25824172734804i,6.42438768145282 - 5.26392179619637i,5.08062633820128 + 3.22077384730369i,2.87647523349818 + 15.4024369047299i,-1.09699269488226 + 21.7088567802274i,-4.35417751011520 + 18.6336972725414i,-0.959837054053961 + 10.7853830504375i,5.93305274912750 + 5.49407866068504i,3.67567845683020 + 8.53897306022087i,-9.96675080151954 + 18.7543229055670i,-18.6950013881798 + 25.2068914711900i,-9.50208868346472 + 18.1058371998714i,7.90107783898677 + 3.23916963036056i,14.6584341907543 - 4.85161998828227i,7.26776481764885 - 3.98822251267789i,-2.81709563479487 - 5.01035550641088i,-7.17120824233633 - 10.5026622492873i,-6.45419544662652 - 9.98659272254211i,-3.14414371870762 - 0.922718652275901i,1.11812075537594 + 3.42270654559008i,3.25331122591012 - 4.42403892677377i,1.67531788788442 - 12.9133768031624i,-0.700366701038033 - 10.2343805327534i,-1.63860839151528 - 1.95345867490093i,-3.70025157711042 + 1.17564876929107i,-8.29731010725842 - 0.0260027161893319i,-11.0000000000000 + 0.00000000000000i,-8.29731010725842 + 0.0260027161893319i,-3.70025157711042 - 1.17564876929107i,-1.63860839151528 + 1.95345867490093i,-0.700366701038031 + 10.2343805327534i,1.67531788788442 + 12.9133768031624i,3.25331122591013 + 4.42403892677377i,1.11812075537594 - 3.42270654559008i,-3.14414371870762 + 0.922718652275902i,-6.45419544662652 + 9.98659272254211i,-7.17120824233633 + 10.5026622492873i,-2.81709563479487 + 5.01035550641088i,7.26776481764885 + 3.98822251267789i,14.6584341907543 + 4.85161998828227i,7.90107783898677 - 3.23916963036057i,-9.50208868346472 - 18.1058371998714i,-18.6950013881798 - 25.2068914711900i,-9.96675080151954 - 18.7543229055670i,3.67567845683020 - 8.53897306022087i,5.93305274912750 - 5.49407866068504i,-0.959837054053959 - 10.7853830504375i,-4.35417751011520 - 18.6336972725414i,-1.09699269488226 - 21.7088567802274i,2.87647523349818 - 15.4024369047299i,5.08062633820128 - 3.22077384730369i,6.42438768145282 + 5.26392179619637i,4.75233997711007 + 6.25824172734804i,-0.345414795043929 + 4.97821899648171i,-2.20863442140189 + 3.28091617477401i,2.61441379692936 - 4.25108109447256i,5.30486866128682 - 14.8534380824198i,-2.30979239744888 - 13.2243014427767i,-12.3639610306789 + 4.70710678118655i,-11.9216445541034 + 18.3799615645749i,-4.04594991894941 + 10.4433778427650i,-2.98970554574952 - 4.84992435279869i,-11.1556710929693 - 2.72084890929627i,-16.1614966118406 + 12.5443284075905i,-10.9888939271200 + 14.9328939636217i,-2.69998829136827 - 0.570917444994684i,1.53059777674791 - 10.4545706240931i,4.40287521524008 - 0.983077314047378i,9.63472782476520 + 12.0247792564488i,12.8586260296814 + 11.0063401331391i,7.65275504767958 + 2.46289421059715i,-4.64858651956890 + 1.56929570665941i,-15.8646306884259 + 7.14288143578215i,-19.2416997294355 + 7.27089271777421i,-14.9243678263375 + 0.214225135763486i,-8.93121477271584 - 4.34232440036480i,-6.92490745612177 - 0.515782984000772i,-8.14639365381708 + 7.47275617114000i,-7.34878122281903 + 12.1022811856371i,-3.06407859095771 + 9.42061447583494i,0.642389406841429 + 1.36599146561462i,1.84155331513556 - 4.93094328918733i,3.34762811648418 - 3.16634331103620i,4.86332057174217 + 4.20949800511183i,1.02175173803957 + 7.69074044697692i,-7.56952269960260 + 2.23969379361818i,-10.5283233615395 - 6.89164455401152i,-2.62656230622164 - 11.2773034566605i,6.33309479605704 - 8.04832692955937i,6.14535461637906 - 0.605257381658685i,2.00000000000000 + 5.00000000000000i,3.53084067245991 + 4.01297898040508i,5.95204903090482 - 2.20194976455440i,-2.17087506401755 - 5.84186227585489i,-16.5328433513147 - 2.10903932916727i,-19.7743660052583 + 3.07713330219342i,-7.19451788678896 + 1.66978561706239i,5.95223989641735 - 2.99121922955727i,6.54226646718272 - 1.27644872736929i,-0.588089878698797 + 5.56256607552181i,-4.38825190307080 + 6.13406025054366i,-3.49775042387883 - 1.49221910676150i,-2.84993925192666 - 5.02441346548206i,-2.85724439998152 + 1.71127266373537i,-0.435254736789402 + 7.51145531938565i,3.53724870389693 + 2.17250800191506i,4.58122207582990 - 6.12892061474413i,0.831421913379234 - 4.55432965544042i,-4.93867527183469 + 2.76636016828351i,-8.43258688166339 + 2.22258520558067i,-7.49177870694967 - 5.82261554836820i,-4.23525566884073 - 7.90146367945420i,-3.48176812266052 - 0.340469886442083i,-6.53635956569336 + 5.57562393724157i,-7.75006116158439 + 3.76489276074335i,-1.55697069711059 + 2.47930365294843i,7.89163497306216 + 7.20101121719990i,9.84164922201441 + 9.30006799095610i,0.654939595330031 + 1.49593638834694i,-10.8531910888782 - 7.73850093976871i,-13.9270089540677 - 7.49199230942724i,-7.62246771883601 - 2.40398527412927i,0.363961030678929 - 3.29289321881345i,3.48662032204610 - 7.26877649808680i,2.27822160062495 - 3.42855481345443i,2.02152457441487 + 5.93022409548124i,6.44354792963908 + 7.55688557849116i,13.4779232780763 - 0.0496686598944827i,16.9839578593330 - 4.40479285623422i,12.9531542149732 - 1.69535272002182i,3.48198279714283 - 2.65816471195959i,-5.49135220763974 - 10.0548224137107i,-8.91669152115041 - 9.90893899770160i,-5.39502418857365 + 4.00007613433042i,1.51718242173715 + 14.8820051382019i,4.37545711115114 + 7.13692560654336i,-0.960701077715447 - 8.96224572591682i,-7.53066460188875 - 13.8455014317568i,-2.96185286131257 - 7.55003722169763i,13.0096168054125 - 3.24638581860534i,23.6703478529117 - 2.28662508103490i,15.4695694927888 + 3.10338533024494i,-2.47365755233150 + 9.50071731017865i,-9.27582676711759 + 7.01130796688241i,-0.00427726768690562 - 0.00531216288670855i,9.55058697596590 + 0.687701290643833i,6.91110338453310 + 5.15575898645043i,-0.845742896619883 - 0.586816432788624i,-0.937511439365313 - 11.9692778628210i,5.31821727368912 - 10.0331851064318i,6.71364290430954 + 3.76246136468684i,0.609577140925421 + 5.86689871572099i,-4.31795855658755 - 8.99696053899199i,-3.02748454294672 - 15.6331310043609i};

  for (int i = 0; i < sss_seq_t_0_0.size(); ++i) {
    EXPECT_NEAR((sss_seq_t_0_0.at(i)).real(), (sss_seq_ref_t_0_0.at(i)).real(),0.00001) << "Vectors x and y differ at real index " << i;
    EXPECT_NEAR((sss_seq_t_0_0.at(i)).imag(), (sss_seq_ref_t_0_0.at(i)).imag(),0.00001) << "Vectors x and y differ at imaginary index " << i;
  }

  for (int i = 0; i < sss_seq_t_10_0.size(); ++i) {
    EXPECT_NEAR((sss_seq_t_10_0.at(i)).real(), (sss_seq_ref_t_10_0.at(i)).real(),0.00001) << "Vectors x and y differ at real index " << i;
    EXPECT_NEAR((sss_seq_t_10_0.at(i)).imag(), (sss_seq_ref_t_10_0.at(i)).imag(),0.00001) << "Vectors x and y differ at imaginary index " << i;
  }

  for (int i = 0; i < sss_seq_t_10_1.size(); ++i) {
    EXPECT_NEAR((sss_seq_t_10_1.at(i)).real(), (sss_seq_ref_t_10_1.at(i)).real(),0.00001) << "Vectors x and y differ at real index " << i;
    EXPECT_NEAR((sss_seq_t_10_1.at(i)).imag(), (sss_seq_ref_t_10_1.at(i)).imag(),0.00001) << "Vectors x and y differ at imaginary index " << i;
  } 
  
  for (int i = 0; i < sss_seq_t_330_2.size(); ++i) {
    EXPECT_NEAR((sss_seq_t_330_2.at(i)).real(), (sss_seq_ref_t_330_2.at(i)).real(),0.00001) << "Vectors x and y differ at real index " << i;
    EXPECT_NEAR((sss_seq_t_330_2.at(i)).imag(), (sss_seq_ref_t_330_2.at(i)).imag(),0.00001) << "Vectors x and y differ at imaginary index " << i;
  }

  for (int i = 0; i < sss_seq_t_335_2.size(); ++i) {
    EXPECT_NEAR((sss_seq_t_335_2.at(i)).real(), (sss_seq_ref_t_335_2.at(i)).real(),0.00001) << "Vectors x and y differ at real index " << i;
    EXPECT_NEAR((sss_seq_t_335_2.at(i)).imag(), (sss_seq_ref_t_335_2.at(i)).imag(),0.00001) << "Vectors x and y differ at imaginary index " << i;
  }

}


TEST_F(sss_test, test_sss_nondefault_constructor) {

  sss sss1(0,0);

  std::array <std::complex<float>,sss_length> sss_seq_f_0_0 = sss1.get_sss_seq_f();
  
  std::array <std::complex<float>,ssb_nfft> sss_seq_t_0_0 = sss1.get_sss_seq_t();

  std::array <std::complex<float>,sss_length> sss_seq_ref_f_0_0 = {1,1,1,1,1,1,1,1,1,1,-1,1,1,1,1,1,-1,1,1,1,-1,1,-1,1,-1,1,1,-1,-1,1,1,1,-1,-1,-1,1,-1,1,-1,1,1,1,1,1,1,1,-1,-1,1,1,1,-1,1,-1,-1,-1,-1,-1,-1,-1,-1,1,-1,1,1,-1,1,1,1,1,-1,1,-1,-1,1,-1,-1,1,-1,1,-1,-1,-1,-1,1,1,-1,-1,-1,-1,1,1,-1,-1,-1,-1,-1,1,1,1,-1,1,-1,1,1,1,1,1,-1,-1,1,1,1,-1,1,1,1,-1,1,1,-1,-1,-1,1,-1,-1,-1};

  std::array <std::complex<float>,ssb_nfft> sss_seq_ref_t_0_0 = {15.0000000000000 + 0.00000000000000i,1.87460998778754 - 17.7858965851639i,-18.3132897805693 - 9.91709206355966i,-17.1278244172334 + 4.70268854507772i,1.90251331766089 - 1.61206404699205i,12.4555523595468 - 14.6615146603342i,4.97726290913886 - 4.31887292993958i,-5.23394636711598 + 20.5379783438541i,-5.06247220663097 + 26.3909511293007i,1.64119402086167 + 11.2123494801934i,6.85139004841865 + 3.44774180138834i,9.70740032666767 + 11.0977669924461i,11.8843228416836 + 13.1883048407800i,12.7411184539848 + 2.35960100649988i,11.8211209092888 - 2.85524594133638i,9.24339132619174 + 5.42870209800814i,3.90454759223490 + 10.0782015624102i,-2.76534515774098 + 1.46373852744816i,-4.18964489915913 - 5.25372393223451i,3.08367619842489 + 1.75593318480560i,11.8589231956831 + 10.4592900767889i,12.7868489900356 + 6.88027365221531i,7.11218859009119 - 2.59957000634467i,2.95177738472598 - 5.30332407865296i,2.14181207027042 - 2.54432728821912i,-0.361366239835540 - 2.12464488252802i,-5.96017789598853 - 3.24883729892375i,-9.90229935731578 - 1.46767400221825i,-8.91325909310723 + 1.08133616810440i,-4.78797302957655 + 0.964257275538173i,-0.898192136649604 + 1.06213396387919i,0.0284628132380282 + 4.35868562954280i,-3.53553390593274 + 7.05025253169417i,-9.07653160207981 + 4.61562880116656i,-10.2137349404516 - 1.47915381987424i,-3.79106587826527 - 7.67356329882094i,6.04584604386793 - 12.0300045693040i,13.6159201395428 - 11.2521793108924i,16.7177619953718 - 2.85781960915429i,13.3318079827629 + 6.65969992832940i,1.03328833703308 + 6.23004036405605i,-15.1454695006998 - 3.06114001888091i,-22.3176945161590 - 6.91431667805214i,-14.6625907041501 + 0.682207097783702i,-2.29443380190876 + 6.82464065272234i,2.07245439752276 - 0.649641479973926i,-1.08722290947847 - 13.7111526000164i,-3.13781846097603 - 16.0574292334405i,-1.21111055711128 - 6.60685419694907i,1.68068234870588 + 2.00672647832387i,4.50533356449759 + 3.65958077752181i,7.20924394594702 + 3.66599278374348i,6.98647304227677 + 4.71751268638048i,3.54339778646632 + 1.63232470052086i,2.07075507430868 - 6.70414046821113i,3.25888812846534 - 11.6007521138069i,-1.27280632081677 - 7.03642120404380i,-13.5414404778579 + 0.286128067683745i,-18.8855311710441 + 1.04668928916793i,-5.50457040512088 - 2.17521271812231i,13.3552516191166 + 0.189321972573641i,14.4582651655260 + 7.81943446618579i,-1.90604221548175 + 9.42324843594065i,-12.2556096616972 + 0.703098161928915i,-4.00000000000000 - 7.00000000000000i,9.47011539143446 - 2.99480980308341i,12.1082940527087 + 5.59777172546633i,6.46727142210239 + 3.60233175304411i,3.28360840683353 - 8.92582317562795i,3.48770826075880 - 15.7078393573149i,1.56321514295044 - 7.91372090502335i,-1.91874164242267 + 3.11024264946632i,-1.98622319391629 + 2.56575406119689i,1.12842082219576 - 7.58054132871029i,2.95704604785531 - 13.4355659619590i,2.97088502463917 - 8.49331917300747i,4.64982305535889 + 0.831714449108203i,8.28836382076034 + 6.46959380496581i,9.45703555012899 + 7.32394906601197i,5.41666647531718 + 6.41709577647934i,-0.445743692381101 + 5.39314580305093i,-2.18380629022141 + 3.63600369208870i,1.76170356258562 + 0.294500650497600i,6.51253171741796 - 3.46919254019235i,6.50789202695628 - 4.04200430674215i,2.60539062172672 + 0.544656426363297i,0.834071549561933 + 5.62061657244099i,3.48514524510736 + 3.58404275592890i,5.28720863662070 - 5.10631691178255i,1.07170730869786 - 10.0653575618908i,-6.37560506004955 - 4.52156591270914i,-10.1317535522448 + 4.21393702647527i,-8.09518296863026 + 3.95992556481479i,-3.74165555312765 - 6.21481943338975i,-0.0765726366883062 - 16.1458742936589i,2.47438055357241 - 18.8412849881979i,3.53553390593274 - 16.9497474683058i,2.72330800454765 - 14.9081284588376i,1.56009662380593 - 12.2214921046694i,1.93771649353451 - 7.45702182370957i,3.46220178927588 - 3.31748660502036i,4.95037713829342 - 3.05995403381688i,6.68839541206822 - 4.45733761934305i,8.51905927744763 - 2.06695201829665i,8.50825370455294 + 4.46246118644991i,6.68533672581427 + 8.33156777470873i,6.46517443994267 + 4.10504956018719i,8.36332216917123 - 4.26702111573707i,6.85257417101065 - 7.90774911126924i,-0.746441803063660 - 4.65330846620940i,-6.84187515485527 - 0.961295039061630i,-3.09673143898788 - 1.21262217902624i,5.75230665725748 - 1.92179843758976i,7.22181718517844 - 0.593410215576255i,-0.644378102827551 - 2.78116709234587i,-6.54372443516863 - 12.0638904637435i,-3.13186603207576 - 18.8841791261012i,2.88817801274175 - 11.2394950486129i,2.15000368382197 + 5.66807514385977i,-4.19755617319727 + 13.5673242687686i,-8.64906102711310 + 6.33627214504901i,-8.30223349291916 - 1.82837699966329i,-4.84825625028860 + 1.95803537918529i,1.45365018721070 + 11.3556031365524i,9.64531238599791 + 12.1977463965476i,12.5954604991840 + 2.77817584263204i,2.95736851314536 - 6.23653945095644i,-14.2450084722396 - 6.67466803360671i,-23.0000000000000 + 0.00000000000000i,-14.2450084722396 + 6.67466803360671i,2.95736851314536 + 6.23653945095644i,12.5954604991840 - 2.77817584263204i,9.64531238599790 - 12.1977463965476i,1.45365018721070 - 11.3556031365524i,-4.84825625028860 - 1.95803537918528i,-8.30223349291916 + 1.82837699966329i,-8.64906102711310 - 6.33627214504901i,-4.19755617319727 - 13.5673242687686i,2.15000368382197 - 5.66807514385978i,2.88817801274175 + 11.2394950486129i,-3.13186603207576 + 18.8841791261012i,-6.54372443516863 + 12.0638904637435i,-0.644378102827552 + 2.78116709234588i,7.22181718517843 + 0.593410215576255i,5.75230665725748 + 1.92179843758976i,-3.09673143898788 + 1.21262217902623i,-6.84187515485528 + 0.961295039061628i,-0.746441803063660 + 4.65330846620940i,6.85257417101065 + 7.90774911126924i,8.36332216917123 + 4.26702111573707i,6.46517443994267 - 4.10504956018719i,6.68533672581427 - 8.33156777470873i,8.50825370455294 - 4.46246118644990i,8.51905927744763 + 2.06695201829665i,6.68839541206822 + 4.45733761934305i,4.95037713829342 + 3.05995403381688i,3.46220178927588 + 3.31748660502036i,1.93771649353450 + 7.45702182370958i,1.56009662380593 + 12.2214921046694i,2.72330800454765 + 14.9081284588376i,3.53553390593274 + 16.9497474683058i,2.47438055357241 + 18.8412849881979i,-0.0765726366883064 + 16.1458742936589i,-3.74165555312765 + 6.21481943338975i,-8.09518296863026 - 3.95992556481479i,-10.1317535522448 - 4.21393702647527i,-6.37560506004956 + 4.52156591270914i,1.07170730869786 + 10.0653575618908i,5.28720863662070 + 5.10631691178255i,3.48514524510736 - 3.58404275592890i,0.834071549561934 - 5.62061657244098i,2.60539062172672 - 0.544656426363300i,6.50789202695628 + 4.04200430674215i,6.51253171741796 + 3.46919254019235i,1.76170356258562 - 0.294500650497600i,-2.18380629022141 - 3.63600369208870i,-0.445743692381101 - 5.39314580305093i,5.41666647531718 - 6.41709577647934i,9.45703555012899 - 7.32394906601196i,8.28836382076034 - 6.46959380496581i,4.64982305535889 - 0.831714449108203i,2.97088502463917 + 8.49331917300747i,2.95704604785531 + 13.4355659619590i,1.12842082219577 + 7.58054132871029i,-1.98622319391629 - 2.56575406119689i,-1.91874164242267 - 3.11024264946632i,1.56321514295044 + 7.91372090502335i,3.48770826075880 + 15.7078393573149i,3.28360840683353 + 8.92582317562795i,6.46727142210240 - 3.60233175304412i,12.1082940527087 - 5.59777172546633i,9.47011539143446 + 2.99480980308341i,-4.00000000000000 + 7.00000000000000i,-12.2556096616972 - 0.703098161928915i,-1.90604221548175 - 9.42324843594065i,14.4582651655260 - 7.81943446618579i,13.3552516191166 - 0.189321972573640i,-5.50457040512088 + 2.17521271812231i,-18.8855311710441 - 1.04668928916793i,-13.5414404778579 - 0.286128067683745i,-1.27280632081677 + 7.03642120404380i,3.25888812846534 + 11.6007521138069i,2.07075507430868 + 6.70414046821113i,3.54339778646632 - 1.63232470052086i,6.98647304227677 - 4.71751268638048i,7.20924394594702 - 3.66599278374348i,4.50533356449759 - 3.65958077752181i,1.68068234870588 - 2.00672647832387i,-1.21111055711128 + 6.60685419694907i,-3.13781846097604 + 16.0574292334405i,-1.08722290947847 + 13.7111526000164i,2.07245439752276 + 0.649641479973927i,-2.29443380190876 - 6.82464065272234i,-14.6625907041501 - 0.682207097783702i,-22.3176945161590 + 6.91431667805214i,-15.1454695006998 + 3.06114001888091i,1.03328833703308 - 6.23004036405605i,13.3318079827629 - 6.65969992832940i,16.7177619953718 + 2.85781960915429i,13.6159201395428 + 11.2521793108924i,6.04584604386793 + 12.0300045693040i,-3.79106587826527 + 7.67356329882094i,-10.2137349404516 + 1.47915381987424i,-9.07653160207981 - 4.61562880116656i,-3.53553390593274 - 7.05025253169417i,0.0284628132380291 - 4.35868562954280i,-0.898192136649604 - 1.06213396387919i,-4.78797302957656 - 0.964257275538173i,-8.91325909310723 - 1.08133616810440i,-9.90229935731577 + 1.46767400221825i,-5.96017789598854 + 3.24883729892375i,-0.361366239835541 + 2.12464488252802i,2.14181207027042 + 2.54432728821912i,2.95177738472598 + 5.30332407865296i,7.11218859009119 + 2.59957000634466i,12.7868489900356 - 6.88027365221531i,11.8589231956831 - 10.4592900767889i,3.08367619842489 - 1.75593318480560i,-4.18964489915913 + 5.25372393223451i,-2.76534515774098 - 1.46373852744816i,3.90454759223490 - 10.0782015624102i,9.24339132619174 - 5.42870209800814i,11.8211209092888 + 2.85524594133638i,12.7411184539848 - 2.35960100649988i,11.8843228416836 - 13.1883048407800i,9.70740032666767 - 11.0977669924461i,6.85139004841865 - 3.44774180138834i,1.64119402086167 - 11.2123494801934i,-5.06247220663098 - 26.3909511293007i,-5.23394636711598 - 20.5379783438541i,4.97726290913886 + 4.31887292993958i,12.4555523595468 + 14.6615146603342i,1.90251331766089 + 1.61206404699205i,-17.1278244172334 - 4.70268854507772i,-18.3132897805693 + 9.91709206355966i,1.87460998778754 + 17.7858965851639i};

  for (int i = 0; i < sss_seq_f_0_0.size(); ++i) {
    EXPECT_FLOAT_EQ((sss_seq_f_0_0.at(i)).real(), (sss_seq_ref_f_0_0.at(i)).real()) << "Vectors x and y differ at real index " << i;
    EXPECT_FLOAT_EQ((sss_seq_f_0_0.at(i)).imag(), (sss_seq_ref_f_0_0.at(i)).imag()) << "Vectors x and y differ at imaginary index " << i;
  }

  for (int i = 0; i < sss_seq_t_0_0.size(); ++i) {
    EXPECT_NEAR((sss_seq_t_0_0.at(i)).real(), (sss_seq_ref_t_0_0.at(i)).real(),0.00001) << "Vectors x and y differ at real index " << i;
    EXPECT_NEAR((sss_seq_t_0_0.at(i)).imag(), (sss_seq_ref_t_0_0.at(i)).imag(),0.00001) << "Vectors x and y differ at imaginary index " << i;
  }
}

TEST_F(sss_test, test_IFFT_shift) {

  sss sss1;
  
  std::array <std::complex<float>,sss_length>  sss_seq_f_0_0 = sss1.generate_sss_seq(0,0);
  std::vector <std::complex<float>> sss_seq_f_0_0_padded(ssb_nfft);
  //Padding with 0's to put the SSS in the correct subcarriers
  sss_seq_f_0_0_padded.insert(sss_seq_f_0_0_padded.begin() + 64, sss_seq_f_0_0.begin(),sss_seq_f_0_0.end());

  std::array <std::complex<float>,ssb_nfft>  sss_seq_ref_f_shifted_0_0 = {1,-1,1,1,1,1,-1,1,-1,-1,1,-1,-1,1,-1,1,-1,-1,-1,-1,1,1,-1,-1,-1,-1,1,1,-1,-1,-1,-1,-1,1,1,1,-1,1,-1,1,1,1,1,1,-1,-1,1,1,1,-1,1,1,1,-1,1,1,-1,-1,-1,1,-1,-1,-1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,-1,1,1,1,1,1,-1,1,1,1,-1,1,-1,1,-1,1,1,-1,-1,1,1,1,-1,-1,-1,1,-1,1,-1,1,1,1,1,1,1,1,-1,-1,1,1,1,-1,1,-1,-1,-1,-1,-1,-1,-1,-1,1,-1,1};
  
    // Perform IFFT shift
  std::rotate(sss_seq_f_0_0_padded.begin(), sss_seq_f_0_0_padded.begin() + 128, sss_seq_f_0_0_padded.end());
  
  for (int i = 0; i < sss_seq_f_0_0.size(); ++i) {
    EXPECT_FLOAT_EQ((sss_seq_f_0_0_padded.at(i)).real(), (sss_seq_ref_f_shifted_0_0.at(i)).real()) << "Vectors x and y differ at real index " << i;
    EXPECT_FLOAT_EQ((sss_seq_f_0_0_padded.at(i)).imag(), (sss_seq_ref_f_shifted_0_0.at(i)).imag()) << "Vectors x and y differ at imaginary index " << i;
  }

}

TEST_F(sss_test, test_sss_generate_all_sequences) {
  sss ssss(0,0);
  auto sss_all_sequences = ssss.generate_all_sss_seq();

  std::array <std::complex<float>,sss_length>  sss_seq_0_0 = sss_all_sequences.at(0*3 + 0);
  std::array <std::complex<float>,sss_length>  sss_seq_10_0 = sss_all_sequences.at(10*3 + 0);
  std::array <std::complex<float>,sss_length>  sss_seq_10_1 = sss_all_sequences.at(10*3 + 1);
  std::array <std::complex<float>,sss_length>  sss_seq_330_2 = sss_all_sequences.at(330*3 + 2);

  std::array <std::complex<float>,sss_length> sss_seq_ref_0_0 = {1,1,1,1,1,1,1,1,1,1,-1,1,1,1,1,1,-1,1,1,1,-1,1,-1,1,-1,1,1,-1,-1,1,1,1,-1,-1,-1,1,-1,1,-1,1,1,1,1,1,1,1,-1,-1,1,1,1,-1,1,-1,-1,-1,-1,-1,-1,-1,-1,1,-1,1,1,-1,1,1,1,1,-1,1,-1,-1,1,-1,-1,1,-1,1,-1,-1,-1,-1,1,1,-1,-1,-1,-1,1,1,-1,-1,-1,-1,-1,1,1,1,-1,1,-1,1,1,1,1,1,-1,-1,1,1,1,-1,1,1,1,-1,1,1,-1,-1,-1,1,-1,-1,-1};  
  std::array <std::complex<float>,sss_length> sss_seq_ref_10_0 = {-1,1,1,-1,-1,1,1,-1,1,-1,-1,-1,1,-1,-1,-1,1,-1,-1,-1,-1,1,-1,1,-1,1,-1,-1,-1,1,1,1,1,1,-1,1,-1,1,1,1,-1,1,1,1,-1,-1,1,1,1,1,-1,-1,1,-1,1,-1,1,1,-1,-1,1,-1,1,1,-1,-1,-1,1,1,-1,1,-1,1,1,1,1,-1,1,-1,1,1,1,1,-1,1,1,1,-1,-1,1,1,1,1,1,-1,1,1,1,-1,1,1,-1,-1,-1,-1,-1,-1,1,1,1,1,1,1,1,-1,1,-1,-1,1,-1,-1,1,1,-1,-1,1,1};
  std::array <std::complex<float>,sss_length> sss_seq_ref_10_1 = {1,1,-1,-1,-1,-1,1,1,-1,1,1,1,1,1,-1,1,1,1,-1,-1,-1,1,1,1,1,-1,-1,1,1,-1,-1,1,1,-1,1,-1,-1,1,-1,1,1,1,-1,-1,-1,-1,-1,-1,1,1,-1,-1,1,1,-1,-1,-1,-1,-1,1,1,1,-1,-1,-1,1,-1,1,1,1,-1,-1,1,-1,1,1,-1,-1,-1,1,1,1,1,-1,-1,1,1,1,-1,1,-1,-1,1,-1,-1,1,-1,-1,1,-1,1,1,1,1,-1,-1,-1,1,-1,-1,-1,-1,-1,-1,1,1,-1,-1,-1,1,1,1,-1,1,-1,1,1};
  std::array <std::complex<float>,sss_length> sss_seq_ref_330_2 = {-1,1,1,-1,1,1,1,1,1,-1,-1,-1,-1,-1,1,1,-1,1,1,1,1,1,1,-1,1,-1,1,-1,-1,1,1,1,-1,1,1,1,1,-1,-1,-1,1,1,-1,-1,-1,-1,-1,-1,1,-1,-1,1,1,-1,1,1,1,-1,-1,-1,1,1,-1,1,1,1,1,-1,-1,-1,1,1,1,1,-1,1,1,-1,1,-1,-1,1,-1,1,-1,1,1,-1,-1,1,1,-1,1,1,1,-1,1,1,-1,1,1,-1,-1,1,1,-1,1,1,1,-1,-1,1,-1,-1,1,-1,-1,1,1,-1,-1,1,-1,1,1,-1,1};
 
  for (int i = 0; i < sss_seq_0_0.size(); ++i) {
    EXPECT_FLOAT_EQ((sss_seq_0_0.at(i)).real(), (sss_seq_ref_0_0.at(i)).real()) << "Vectors x and y differ at real index " << i;
    EXPECT_FLOAT_EQ((sss_seq_0_0.at(i)).imag(), (sss_seq_ref_0_0.at(i)).imag()) << "Vectors x and y differ at imaginary index " << i;
  }

  for (int i = 0; i < sss_seq_10_0.size(); ++i) {
    EXPECT_FLOAT_EQ((sss_seq_10_0.at(i)).real(), (sss_seq_ref_10_0.at(i)).real()) << "Vectors x and y differ at real index " << i;
    EXPECT_FLOAT_EQ((sss_seq_10_0.at(i)).imag(), (sss_seq_ref_10_0.at(i)).imag()) << "Vectors x and y differ at imaginary index " << i;
  }

  for (int i = 0; i < sss_seq_10_1.size(); ++i) {
    EXPECT_FLOAT_EQ((sss_seq_10_1.at(i)).real(), (sss_seq_ref_10_1.at(i)).real()) << "Vectors x and y differ at real index " << i;
    EXPECT_FLOAT_EQ((sss_seq_10_1.at(i)).imag(), (sss_seq_ref_10_1.at(i)).imag()) << "Vectors x and y differ at imaginary index " << i;
  }

  for (int i = 0; i < sss_seq_330_2.size(); ++i) {
    EXPECT_FLOAT_EQ((sss_seq_330_2.at(i)).real(), (sss_seq_ref_330_2.at(i)).real()) << "Vectors x and y differ at real index " << i;
    EXPECT_FLOAT_EQ((sss_seq_330_2.at(i)).imag(), (sss_seq_ref_330_2.at(i)).imag()) << "Vectors x and y differ at imaginary index " << i;
  }
}